<?php
header("Pragma: public");
header("Expires: 0");
header("Accept-Ranges: bytes");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-Type: application/vnd.ms-word");
header('Content-Disposition: attachment; filename=totalabiturientsdigits.doc');
header("Content-Transfer-Encoding: binary"); 
 //debug($totalabiturientsdigits);
 $professionscount = count($totalabiturientsdigits);
?>

<p align="center"><strong>Количество  поданных заявлений на <?php echo date('d.m.Y'); ?> г.</strong></p>
<table width="100%" border="1" cellspacing="1" cellpadding="1">
  <tr>
    <th width="30%" scope="col">Наименование специальности</th>
    <th width="15%" scope="col">Уровень образования</th>
    <th width="15%" scope="col">Форма обучения</th>
    <th colspan="2" scope="col">Бюджет</th>
    <th colspan="2" scope="col">Внебюджет</th>
  </tr>
  <?php 
  $i = 0;
 	while  ($i< $professionscount) {
	/* if (!empty($totalabiturientsdigits[$i]) && !empty($totalabiturientsdigits[$i+1])) */
  ?>
  <tr>
    <td width="30%">
    	<?php 
    		echo $professions[$totalabiturientsdigits[$i]['profession']];
    	?>
    </td>
    <td width="15%">
    	<?php 
    		echo $educationlevels[$totalabiturientsdigits[$i]['educationlevel']];
    	?>    
    </td>
    <td width="15%">
    	<?php 
    		echo $learningforms[$totalabiturientsdigits[$i]['learnigform']];
    	?>    
    </td>
    <td align="center">
        <?php 
    		echo $totalabiturientsdigits[$i]['digits'];
    	?> 
    </td>
    <td align="center">
        <?php 
    		echo $totalabiturientsdigits[$i]['applicationcount'];
    	?>     
    </td>
    <td align="center">
        <?php 
    		echo $totalabiturientsdigits[$i+1]['digits'];
    	?> 
    </td>
    <td align="center">
        <?php 
    		echo $totalabiturientsdigits[$i+1]['applicationcount'];
    	?>     
    </td>
  </tr>
 <?php 
 	$i = $i + 2;
 }
 ?> 
</table>

